package com.yanqu.road.logic.sort;

import com.yanqu.road.entity.rank.yrank.UserYRank;

import java.util.Comparator;
import java.util.Objects;

public class LangYaBuildingRankSort implements Comparator<UserYRank> {

    @Override
    public int compare(UserYRank o1, UserYRank o2) {
        if (!Objects.equals(o1.getParam(), o2.getParam())){
            Integer o1int = Integer.valueOf(o1.getParam());
            Integer o2int = Integer.valueOf(o2.getParam());
            return o2int.compareTo(o1int);
        }
        if (!Objects.equals(o1.getValue(), o2.getValue())) {
            return o2.getValue().compareTo(o1.getValue());
        }
        return Long.compare(o1.getUpdateTime(), o2.getUpdateTime());
    }
}
